home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / mac / developm / source / ncsat.cpt / Telnet2.5 final / main / switchback.a < prev    next >
Encoding:
Text File  |  1991-12-23  |  1.1 KB  |  57 lines

  1. ;        The NCSA Switcher background processor
  2.  
  3.     blanks off
  4.     case on
  5.  
  6. Snastyhack    PROC    EXPORT
  7.  
  8. ;
  9. ;
  10. ;        PUBLIC    _BKGRtask,_initBKGR
  11.         EXPORT initBKGR, BKGRtask
  12. initBKGR
  13.         LEA        A5ptr,A0
  14.         MOVE.L    A5,D0
  15.         MOVE.L    D0,0(A0)
  16.  
  17.         LEA        JumpTo,A0
  18.         MOVE.L    4(SP),D0
  19.         MOVE.L    D0,0(A0)
  20.         RTS
  21.  
  22.     
  23. BKGRtask
  24.         MOVEA.L    #$282,A0        ; Get the Switcher pointer
  25.         MOVEA.L    (A0),A0            ; Dereference once
  26.         MOVE.L    36(A0),d0        ; Move the current Task into d0
  27.         MOVE.L    (a1),a1            ; This looks much better!
  28.         CMPA.L    d0,a1            ; is this my task?
  29.         BNE.s    BKGR1            ; if not then do our job.
  30.         RTS                        ; otherwise go back to executing
  31. BKGR1:
  32.         LEA        A5save,A0        ; Prepare to save current A5
  33.         MOVE.L    A5,d0            ; Move to valid spot
  34.         MOVE.L    D0,(a0)            ; store it 
  35.  
  36.         LEA        A5ptr,A0        ; Ready to get ours?
  37.         MOVEA.L    (a0),A5            ; Load 'er up!
  38.  
  39.         CLR.W    -(a7)            ; Clear stack
  40.         LEA        JumpTo,A0        ; Where do we go?
  41.         MOVEA.L    (a0),a0            ; Lets go there!
  42.         JSR        (a0)            ; Go to the JumpTo Address
  43.                                 ; Call netsleep(0)
  44.  
  45.         ADDQ.L    #2,a7            ; Fix the stack.
  46.  
  47.         LEA        A5save,A0        ; Prepare to give control back
  48.         MOVEA.L    (a0),a5            ; Load 'er up!
  49.         RTS
  50.  
  51. A5ptr    DC.L    0
  52. A5save    DC.L    0
  53. JumpTo    DC.L    0
  54.     ENDPROC
  55.     
  56.     END
  57.